home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
qsrc_dsk.zip
/
MODEL
/
BROWSEB.PRG
< prev
next >
Wrap
Text File
|
1991-12-17
|
3KB
|
71 lines
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ BROWSEB.PRG ║
* ║ ║
* ╟─────────────────────────────────────────────────────────╢
* ║ Application Developed in _Using FoxPro 2_ ║
* ║ ║
* ║ Lisa C. Slater and Steven E. Arnott ║
* ║ ║
* ║ Copyright (c) 1991 Que Publishing ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
* We used this simple procedure while we wrote the
* book to set up a browse in which we could create the data
* in the budget file interactively.
* It serves to demonstrate some of the concepts you learn
* in Chapters 3 and 8 (browsing related files, validating
* data as you enter it interactively, using calculated fields).
* MODIFYing a MEMO along with its other browse fields is demonstrated
* here as well.
* The :V clause on the Period field could easily have been made into a
* User Defined Function instead of a complex expression.
* This particular validation (using only the first day of the quarter)
* turned out to be unnecessary in the way we used the field for querying
* purposes; see the expression used to determine the Quarter for any
* date presented in chap5004.qpr, and in Chapter 13 as the FUNCTION Pd()
* in the code for BUDGET.SCX.
* If you have already run CreateV.PRG,
* you can substitute the line
* SET VIEW TO Model
* for all the lines before the actual BROWSE command.
CLEAR
CLOSE ALL
USE Budget
USE Budcat ORDER TAG budcatcode IN SELECT(1)
USE Product ORDER TAG prodcode IN SELECT(1)
USE Dept ORDER TAG deptcode IN SELECT(1)
SET RELATION TO budcatcode INTO Budcat,;
prodcode INTO Product,;
deptcode INTO Dept
DEFINE WINDOW memob FROM 17,1 TO 23,78 COLOR SCHEME 10
DEFINE WINDOW browseb FROM 2,1 TO 15,78 COLOR SCHEME 10
MODI MEMO budget.notes SAVE NOWAIT WINDOW memob
BROWSE;
FIELDS budget.deptcode :V=!EOF("Dept") :E= "Invalid code!", ;
budget.prodcode :V=!EOF("Product") :E= "Invalid code!", ;
budget.budcatcode :V=!EOF("budcat") :E= "Invalid code!", ;
budget.period :V= INLIST(MONTH(period),1,4,7,10) AND ;
DAY(period) = 1 ;
:E= "Use first day of quarter!", ;
budget.budgetamt,;
budget.final :H="Fnl?",;
product.prodname :W =.F. :15 ,;
howmany = STR(RECNO(),2) :H="#Recs" ;
VALID :F ! EMPTY(budget.deptcode) AND ;
! EMPTY(budget.prodcode) AND ;
! EMPTY(budget.budcatcode) ;
ERROR "No empty codes!" ;
TITLE "Creating Budget File for Widget Model Application: "+MDY(DATE()) ;
WINDOW browseb SAVE NOWAIT
RELEASE WINDOW browseb
RETURN